package testMagic;

import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import org.junit.Test;

import magic.*;
import player.*;

public class testMagicWindow extends TestCase{
	
	@Test
	public void testShowResult_1() throws Exception{
		Player p = new Player();
		MagicWindow mw = new MagicWindow(p);
		
		String expected = "Sorry, You do not get any Magic Card this time";
		String actual = mw.showResult(1);	
		assertEquals(expected, actual);
	}
	
	@Test
	public void testShowResult_2() throws Exception{
		Player p = new Player();
		MagicWindow mw = new MagicWindow(p);
		
		String expected = "Congratulation, you get a SEValue, Your SE value can remain unchange 1 turn";
		String actual = mw.showResult(2);	
		assertEquals(expected, actual);
	}
	
	PrintStream oldPrintStream;
	ByteArrayOutputStream bos;  

	private void setOutput() throws Exception
	{
		oldPrintStream = System.out;
		bos = new ByteArrayOutputStream();  
		System.setOut(new PrintStream(bos)); 
	}
	
	private String getOutput() //throws Exception
	{
		System.setOut(oldPrintStream);
		return bos.toString();
	}
}
